home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / Java2 / src / java / security / PrivilegedAction.java < prev    next >
Encoding:
Java Source  |  1999-05-28  |  1.6 KB  |  46 lines  |  [TEXT/CWIE]

  1. /*
  2.  * @(#)PrivilegedAction.java    1.4 98/06/29
  3.  *
  4.  * Copyright 1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.security;
  16.  
  17.  
  18. /**
  19.  * A computation to be performed with privileges enabled.  The computation is
  20.  * performed by invoking <code>AccessController.doPrivileged</code> on the
  21.  * <code>PrivilegedAction</code> object.  This interface is used only for
  22.  * computations that do not throw checked exceptions; computations that
  23.  * throw checked exceptions must use <code>PrivilegedExceptionAction</code>
  24.  * instead.
  25.  *
  26.  * @see AccessController
  27.  * @see AccessController#doPrivileged(PrivilegedAction)
  28.  * @see PrivilegedExceptionAction
  29.  */
  30.  
  31. public interface PrivilegedAction {
  32.     /**
  33.      * Performs the computation.  This method will be called by
  34.      * <code>AccessController.doPrivileged</code> after enabling privileges.
  35.      *
  36.      * @return a class-dependent value that may represent the results of the
  37.      *           computation. Each class that implements
  38.      *         <code>PrivilegedAction</code>
  39.      *           should document what (if anything) this value represents.
  40.      * @see AccessController#doPrivileged(PrivilegedAction)
  41.      * @see AccessController#doPrivileged(PrivilegedAction,
  42.      *                                     AccessControlContext)
  43.      */
  44.     Object run();
  45. }
  46.